//
//  Weekly.m
//  BiuWeather
//
//  Created by 楼楚 on 16/3/12.
//  Copyright © 2016年 Chu Lou. All rights reserved.
//

#import "Weekly.h"

@implementation Weekly
-(id)initWithDictionary:(NSDictionary *)dic
{
    self = [super self];
    if (self) {
        NSArray *arr = dic;
        
//        
//            NSDate  *sa = [NSDate date];
//            NSDateFormatter *datefo = [[NSDateFormatter alloc]init];
//        
//            [datefo setDateFormat:@"YYYY-MM-dd"];
//            NSString *now = [datefo stringFromDate:sa];
        self.oneWeek = arr;
        NSDictionary *dicN = arr[0];
//        NSLog(@"今天的情况%@",dicN);
        NSDictionary *dic1 = [dicN objectForKey:@"astro"];
//        NSLog(@"今天是%@",[dicN objectForKey:@"date"]);
        self.sunRiseTime = [dic1 objectForKey:@"sr"];
      
        self.sunSetTime = [dic1 objectForKey:@"ss"];
        
        NSDictionary *dic2 = [dicN objectForKey:@"tmp"];
        
        self.maxTmp = [dic2 objectForKey:@"max"];
         self.minTmp = [dic2 objectForKey:@"min"];
//        NSLog(@"test");
//        for (int i = 0; i<7; i++) {
//           
//            NSDictionary *dicN = [arr objectAtIndex:i];
////            NSLog(@"-------dicshi-----第%i个-------------%@",i,dicN);
//            NSString *str = [dicN objectForKey:@"date"];
//            NSLog(@"---------%@和%@---------",now,str);
//            if (str == now) {
//                             NSDictionary *dic1 = [dicN objectForKey:@"astro"];
//                self.sunRiseTime = [dic1 objectForKey:@"sr"];
//                self.sunSetTime = [dic1 objectForKey:@"ss"];
//                
//                NSDictionary *dic2 = [dicN objectForKey:@"tmp"];
//                
//                self.maxTmp = [dic2 objectForKey:@"max"];
//                self.minTmp = [dic2 objectForKey:@"min"];
//                break;
//            }else{
//                NSLog(@"~~~~~~~~test");
//
//            }
//        }
    }
    return self;
}
@end
